#pragma once

#include "ILCommon.h"
#include <d3d11.h>
#include <d3dx11.h>
#include "d3dx11effect.h"


class CFX
{
public:
	
private:
	
};

class CUintClearFX : public CFX
{
public:
	CUintClearFX(ID3D11Device* pDevice);
	void Render(UINT clrColor[4]);
private:
	ID3D11Device* m_pDevice;
	ID3DX11Effect* m_pEffect;
	ID3D11Buffer* m_pVertexBuffer;
	ID3D11InputLayout* m_pInputLayout;
};

class CD3DHelper
{
public:
	CD3DHelper(ID3D11Device* pDevice);
	HRESULT ClearRenderTargetViewUint(ID3D11DeviceContext* pContext, ID3D11RenderTargetView* pRTToClear, UINT clrColor[4] );
	static HRESULT CreateBuffer(ID3D11Device* pDevice, void* pData, UINT szElement, UINT nElements, ID3D11Buffer*& pBuffer, DWORD bindFlags);
	static HRESULT CreateVertexBuffer(ID3D11Device* pDevice, void* vertices, UINT szVertex, UINT nVertices, ID3D11Buffer*& pVertexBuffer);
	static HRESULT CreateIndexBuffer(ID3D11Device* pDevice, void* ind, UINT szIndex, UINT nIndex, ID3D11Buffer*& pIndexBuffer);
	static HRESULT CreateInputLayout(ID3D11Device* pDevice,const D3D11_INPUT_ELEMENT_DESC* layout, UINT numElements, ID3DX11EffectPass* pEffectPass, ID3D11InputLayout*& pInputLayout);
	static ID3D11DeviceContext* GetImmediateContext(ID3D11Device* pDevice);
	static HRESULT CreateEffectFromFile(ID3D11Device* pDevice, char* pSrcFile, ID3DX11Effect*& pEffect);
	static UINT GetNumPassesInTechByIndex(ID3DX11Effect* pEffect, UINT TechIndex, HRESULT* hr = NULL);
	static ID3D11Texture2D* CreateTextureFile(ID3D11Device* pDevice, string FileName);
	static HRESULT CreateDSBufferAndView(ID3D11Device* pDevice, UINT width, UINT height, DXGI_FORMAT format, ID3D11Texture2D*& pDS, ID3D11DepthStencilView*& pDSV);
private:
	CUintClearFX m_UintClearFX;
};